//
//  FGLastestVoucherView.m
//  Mi6App
//
//  Created by Mr.Lemon on 8/30/13.
//  Copyright (c) 2013 4G Secure. All rights reserved.
//

#import "FGLastestVoucherView.h"
#import "FGNewVoucherViewController.h"

@implementation FGLastestVoucherView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}



-(void)setViewWithVoucherObject:(FGVoucherInfo*)voucherInfo andIndex:(NSInteger)index{
    self.indexVoucher=index;
    
    [self setBackgroundColor:[UIColor clearColor]];
    NSString *urlImg = [NSString stringWithFormat:@"%@%@",kAPIBaseURKImage,voucherInfo.urlImage];
    [self.imgVoucher setImage:[UIImage imageNamed:voucherInfo.urlImage]];
    self.lblVoucherTitle.text = voucherInfo.title;
    self.lblVoucherName.text=voucherInfo.description;
}


- (IBAction)onBtnNerverClick:(id)sender {
    
    [self.delegate onClickVoucherWithType:NERVER_DISLAY      andIndex:self.indexVoucher];
    
    [self disableAllButton];
    
}

- (IBAction)onBtnMaybeClick:(id)sender {
    [self.delegate onClickVoucherWithType:REMIND_LATER      andIndex:self.indexVoucher];
        [self disableAllButton];
}

- (IBAction)onBtnSaveClick:(id)sender {
    [self.delegate onClickVoucherWithType:SAVE_VOUCHER      andIndex:self.indexVoucher];
        [self disableAllButton];
}
-(void)disableAllButton{
[self.btnReminLater setUserInteractionEnabled:FALSE];
    [self.btnNever setUserInteractionEnabled:FALSE];
    [self.btnSaveVoucher setUserInteractionEnabled:FALSE];
}
@end
